﻿<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <link type="text/css" rel="stylesheet" href="//apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css" />
    <link type="text/css" rel="stylesheet" href="~/Styles/iui/1.0.0/cSun.css" />
    <link type="text/css" rel="stylesheet" href="~/Styles/iui/1.0.0/Themes/Default/tWidget.css" />
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.js"></script>
    <script type="text/javascript" src="//g.alicdn.com/kissy/k/5.0.1/seed-debug.js" data-config="{debug:true}"></script>
    <script type="text/javascript" src="~/Scripts/iui/1.0.0/iui.js"></script>

</head>
<body style="background: #fff none repeat scroll 0 0;">

    <div class="container-fluid body" style="background: #fff none repeat scroll 0 0; padding: 0 0;">
        @RenderBody()
    </div>

    <script type="text/javascript">
        var form = $(document).find("form");
        form.find("button[type='submit']").on("click", function (event) {
            event.preventDefault();
            var queryParam = form.serializeArray();
            var action = form.attr('action');
            var metthod = form.attr('method');
            $.ajax({
                url: action,
                type: "post",
                data: queryParam,
                dataType: "text",
                success: function (data) {
                    var result = $.parseJSON(data);
                    if (result.success == 0) {
                        alert(result.error);
                    } else {
                        parent.iui.dialog.done(result.result);
                    }
                },
            })
        })

        form.find("button[type='button']").on("click", function (event) {
            parent.iui.dialog.close();
        })
    </script>
</body>
</html>


